package 算法.leetcode;

/**
 * @author:谢君臣
 * @Date:2021/5/19-10:35
 * @version:1.0
 * @function:
 */
public class lc05 {
    public static void main(String[] args) {
        System.out.println(replaceSpace("We are happy."));
    }
    public static String replaceSpace(String s) {
        StringBuilder res = new StringBuilder();
        for (int i = 0;i<s.length();i++) {
            char c = s.charAt(i);
            if (c==' ')res.append("%20");
            else res.append(String.valueOf(c));
        }
        return res.toString();
    }
}
